﻿<UserControl x:Class="FIFP.DashBoard.Views.Scanario"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"   
    xmlns:telerikChart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
    xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
    mc:Ignorable="d"    
    xmlns:Presentation="clr-namespace:FIFP.Common.Behaviors.CommonEventArgs;assembly=FIFP.Common"
    DataContext="{Binding ChartViewModel,Source={StaticResource ServiceLocator}}"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"   
    d:DesignHeight="1028" d:DesignWidth="1920">

    <Grid x:Name="LayoutRoot" Background="{StaticResource MainBackground}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="260"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <Grid Margin="10,0,10,10" Width="240">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
    		<TextBlock TextWrapping="Wrap" Text="Start Date" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,0,0,4"/>
    		<sdk:DatePicker x:Name="startdatePicker" Grid.Row="1" HorizontalAlignment="Left" Style="{StaticResource DatePickerStyle}" CalendarStyle="{StaticResource CalendarStyle}" DisplayDate="{Binding StartDate, Mode=TwoWay}" SelectedDate="{Binding StartDate, Mode=TwoWay}" Margin="0,0,0,10"/>
            <TextBlock TextWrapping="Wrap" Grid.Row="2" Text="End Date" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,0,0,4"/>
            <sdk:DatePicker x:Name="endDatePicker" Grid.Row="3" HorizontalAlignment="Left" Style="{StaticResource DatePickerStyle}" CalendarStyle="{StaticResource CalendarStyle}" DisplayDate="{Binding EndDate, Mode=TwoWay}" SelectedDate="{Binding EndDate, Mode=TwoWay}" Margin="0,0,0,4" />
            <Button Tag="refresh" x:Name="btnRefresh" Grid.Row="4" Cursor="Hand" HorizontalAlignment="Left" Command="{Binding ReloadScenarioEvent}" CommandParameter="{Binding ElementName=btnRefresh}" Content="Reload" Margin="0,10,0,0" Width="100" Height="28" Style="{StaticResource OverlapButtonStyle}" />
            <ListBox Margin="0,15,0,0" Grid.Row="5" Background="#FF303440" BorderBrush="{x:Null}" ItemsSource="{Binding FilteredCapacityDataList}" ItemContainerStyle="{StaticResource ScenarioListBoxItemStyle}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
    			<ListBox.ItemTemplate>
    				<DataTemplate>
    					<CheckBox x:Name="chkCapacity" ClickMode="Press" Tag="{Binding CapacityTypeName}" IsChecked="{Binding ItemChecked, Mode=TwoWay}" Content="{Binding CapacityName}" Command="{Binding ChartViewModel.CapacityCommand, Source={StaticResource ServiceLocator}}" CommandParameter="{Binding ElementName=chkCapacity}" Style="{StaticResource CheckBoxStyle}" Margin="0,0,0,3" />
    				</DataTemplate>
    			</ListBox.ItemTemplate>
    		</ListBox>

            <TextBlock TextWrapping="Wrap" Grid.Row="6"  Text="Select My Scenario's" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,0,0,4"/>

            <ComboBox x:Name="cmbScenario" Grid.Row="7"  Margin="0,5,0,0" ItemsSource="{Binding UserScenarioList}" DisplayMemberPath="ScenarioName" SelectedItem="{Binding SelectedScenario, Mode=TwoWay}" VerticalAlignment="Top" Style="{StaticResource ComboBoxStyleRightDropArrow}" Height="30" ItemContainerStyle="{StaticResource ComboBoxItemStyle}">
    			<i:Interaction.Triggers>
    				<i:EventTrigger  EventName="SelectionChanged">
    					<i:InvokeCommandAction Command="{Binding ScenarioSelectionCommand}" CommandParameter="{Binding ElementName=cmbScenario}"  />
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</ComboBox>

            <TextBlock Grid.Row="8" TextWrapping="Wrap" Text="My Scenario's" Visibility="{Binding CurrentUserScenarioVisibility}" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,10,0,4"/>

            <ListBox Grid.Row="9"  Margin="0,5,0,10" Background="#FF303440" BorderBrush="{x:Null}" ItemsSource="{Binding CurrentUserScenarioList}" Visibility="{Binding CurrentUserScenarioVisibility}" ItemContainerStyle="{StaticResource ScenarioListBoxItemStyle}" Style="{StaticResource ListBoxStyle1}">
    			<ListBox.ItemTemplate>
    				<DataTemplate>
    					<CheckBox x:Name="chkScenario" ClickMode="Press" Tag="{Binding ScenarioName}" IsChecked="{Binding ItemChecked, Mode=TwoWay}" Content="{Binding ScenarioName}" Command="{Binding ChartViewModel.ScenarioCommand, Source={StaticResource ServiceLocator}}" CommandParameter="{Binding ElementName=chkScenario}" Style="{StaticResource CheckBoxStyle}" Margin="0,0,0,3" />
    				</DataTemplate>
    			</ListBox.ItemTemplate>
    		</ListBox>

            <TextBlock TextWrapping="Wrap" Grid.Row="10"  Text="Select Other's Scenario" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,0,0,4"/>

            <ComboBox x:Name="cmbOthersScenario" Grid.Row="11"  Margin="0,5,0,0" ItemsSource="{Binding OthersScenarioList}" DisplayMemberPath="ScenarioName" SelectedItem="{Binding SelectedOtherScenario, Mode=TwoWay}" VerticalAlignment="Top" Style="{StaticResource ComboBoxStyleRightDropArrow}" Height="30" ItemContainerStyle="{StaticResource ComboBoxItemStyle}">
                <i:Interaction.Triggers>
                    <i:EventTrigger  EventName="SelectionChanged">
                        <i:InvokeCommandAction Command="{Binding OtherScenarioSelectionCommand}" CommandParameter="{Binding ElementName=cmbOthersScenario}"  />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </ComboBox>
            
            <TextBlock Grid.Row="12" TextWrapping="Wrap" Text="Other User's Scenarios" Visibility="{Binding OtherUserScenarioVisibility}" Style="{StaticResource SmallHeadingBold}" VerticalAlignment="Top" Margin="0,5,0,4"/>

            <ListBox Grid.Row="13" Margin="0,5,0,10" Background="#FF303440" BorderBrush="{x:Null}" Visibility="{Binding OtherUserScenarioVisibility}" ItemsSource="{Binding OtherUsersScenarioList}" ItemContainerStyle="{StaticResource ScenarioListBoxItemStyle}" Style="{StaticResource ListBoxStyle1}">
    			<ListBox.ItemTemplate>
    				<DataTemplate>
    					<CheckBox x:Name="chkScenario" ClickMode="Press" Tag="{Binding ScenarioName}" IsChecked="{Binding ItemChecked, Mode=TwoWay}" Content="{Binding ScenarioName}" Command="{Binding ChartViewModel.ScenarioCommand, Source={StaticResource ServiceLocator}}" CommandParameter="{Binding ElementName=chkScenario}" Style="{StaticResource CheckBoxStyle}" Margin="0,0,0,3" />
    				</DataTemplate>
    			</ListBox.ItemTemplate>
    		</ListBox>

    	</Grid>
        <Grid Grid.Column="1">
            <telerikChart:RadChart x:Name="radChart"  Style="{StaticResource ChartStyle}" TitleStyle="{StaticResource ChartTitleStyle}" LegendStyle="{StaticResource ChartLegendStyle}">
                <i:Interaction.Triggers>
                    <i:EventTrigger  EventName="Loaded">
                        <i:InvokeCommandAction Command="{Binding RadChartLoadedCommand}" 
        							CommandParameter="{Binding ElementName=radChart}"  />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <telerikChart:RadChart.DefaultView>
                    <telerikCharting:ChartDefaultView ChartLegendPosition="Top">

                        <telerikCharting:ChartDefaultView.ChartTitle>
                            <telerikCharting:ChartTitle Content="" HorizontalAlignment="Stretch"/>
                        </telerikCharting:ChartDefaultView.ChartTitle>

                        <telerikCharting:ChartDefaultView.ChartLegend>
                            <telerikCharting:ChartLegend x:Name="chartLegend" Header=""/>
                        </telerikCharting:ChartDefaultView.ChartLegend>

                        <telerikCharting:ChartDefaultView.ChartArea>

                            <telerikCharting:ChartArea LegendName="chartLegend"   PlotAreaStyle="{StaticResource ClipPanelStyle}">

                                <telerikCharting:ChartArea.AxisX>
                                    <telerikCharting:AxisX Title="" IsDateTime="False" LayoutMode="Between">
                                        <telerikCharting:AxisX.AxisStyles>
                                            <telerikCharting:AxisStyles AxisLineStyle="{StaticResource AxisLineStyle}" TickLineStyle="{StaticResource AxisTickStyle}" GridLineStyle="{StaticResource GridLineStyle}" ItemLabelStyle="{StaticResource XItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}"/>
                                        </telerikCharting:AxisX.AxisStyles>
                                    </telerikCharting:AxisX>
                                </telerikCharting:ChartArea.AxisX>

                                <telerikCharting:ChartArea.AxisY>
                                    <telerikCharting:AxisY Title="MBD" MinValue="0" MaxValue="400" Step="50" AutoRange="False" StripLinesVisibility="Collapsed" MajorGridLinesVisibility="Visible" MinorTicksVisibility="Collapsed" ExtendDirection="None" >
                                        <telerikCharting:AxisY.AxisStyles>
                                            <telerikCharting:AxisStyles AxisLineStyle="{StaticResource AxisLineStyle}" TickLineStyle="{StaticResource AxisTickStyle}" GridLineStyle="{StaticResource GridLineStyle}" ItemLabelStyle="{StaticResource YItemLabelStyle}" TitleStyle="{StaticResource AxisTitleStyle}"/>
                                        </telerikCharting:AxisY.AxisStyles> 
                                    </telerikCharting:AxisY>
                                </telerikCharting:ChartArea.AxisY>
                            </telerikCharting:ChartArea>
                        </telerikCharting:ChartDefaultView.ChartArea>
                    </telerikCharting:ChartDefaultView>
                </telerikChart:RadChart.DefaultView>

            </telerikChart:RadChart>
        </Grid>
    </Grid>
</UserControl>
